1. Field of the Invention
The present invention generally relates to a connection unit for a peripheral device which is connected to a host by using, for example, a Universal Serial Bus (USB) interface. More particularly, the invention relates to a connection unit for a peripheral device that automatically recovers the connection when an abnormality occurs in the communication between the peripheral device and the host.
2. Description of the Related Art
An example of a conventional connection arrangement between a host and a peripheral device is illustrated in FIG. 5. In particular, FIG. 5 shows a block circuit diagram for a connection between a conventional USB-compatible peripheral device (terminal) 10 and a host (computer unit) 2. The peripheral device 10 that is to be connected to the host 2 via a USB may be one of various types of devices, such as a keyboard, a mouse, a printer, a speaker, a game controller, etc.
In FIG. 5, he USB is formed of four lines, such as a pair of data lines (D+ line and Dxe2x88x92 line), a power line (Vcc), and a ground line (G).
As shown in FIG. 5, a USB port 3 is provided in the host 2, and a USB controller 11 is provided in the peripheral device 10. The USB controller 11 is connected to the USB port 3 via a USB-compatible cable 4.
The data line Dxe2x88x92 of the USB port 3 is connected to one end of a pull-down resistor R1, and the data line D+ of the USB port 3 is connected to one end of a pull-down resistor R2. The other ends of the pull-down resistors R1 and R2 are connected to ground lines G.
In the peripheral device 10, one end of a pull-up resistor R3 is connected to the Dxe2x88x92 line and the other end is connected to the power line (Vcc).
With the configuration illustrated in FIG. 5, when the peripheral device 10 is not connected to the host 2, the potential at a point P is 0 volts (low state). When the peripheral device 10 is connected to the host 2, the Dxe2x88x92 line, the D+ line, the power line Vcc, and a ground line of the peripheral device 10 are connected to the counterparts of the host 2, and the potential at the point P is increased (high state). When the host 2 identifies such a potential increase, it determines that the peripheral device 10 is connected to the host 2. Simultaneously, the host 2 starts to perform a polling operation by calling the peripheral device 10 at regular intervals so that mutual communication is established between the host 2 and the peripheral device 10. During the polling operation, in response to receiving a calling signal from the host 2, the peripheral device 10 returns a signal to the host 2. The peripheral device returns this signal regardless of whether or not the peripheral device 10 is being operated.
When the cable 4 is disconnected to remove the peripheral device 10 from the host 2, the point P is connected to the ground line G and thus decreases to 0 volts. A voltage or potential drop is detected in the host 2. From the voltage drop the host 2 determines that the peripheral device 10 is disconnected.
In this manner, by monitoring whether the potential at the point P is in the high state or the low state, the host 2 is able to determine whether the peripheral device 10 is connected or disconnected.
If, however, during polling there is no answer from the peripheral device 10 in response to three consecutive calls by the host 2, the host 2 discontinues the polling to the peripheral device 10, thereby interrupting the communication between the host 2 and the peripheral device 10. In order to recover from the interrupted communication, the cable 4 of the peripheral device 10 must first be disconnected from the USB port 3 so that the potential at the point P drops to a ground potential (low state). The cable 4 must then be re-inserted into the USB port 3 so that the potential is again raised to the high state. Alternatively, an operating system loaded on the host 2 must be restarted.
The peripheral device 10, on the other hand, has a resetting (initializing) function. For example, when a malfunction occurs in the peripheral device 10 (such as a voltage change, the departure of processing from a fixed program routine, or a memory malfunction) the peripheral device 10 automatically detects such a malfunction and performs the resetting operation. If there is no answer from the peripheral device 10 in response to the polling by the host 2 a predetermined number of times and communication therebetween is interrupted during the occurrence of such a malfunction, the peripheral device 10 performs the resetting operation to recover. When, a signal cannot be transmitted from the peripheral device 10 to the host 2, in spite of the resetting operation by the peripheral device 10, it is necessary to either remove the cable 4 from the USB port 3 and re-insert it to the USB port 3, or restart the system.
Accordingly, in order to solve the above-described problems, it is an object of the present invention to provide a connection unit for a peripheral device which automatically recovers from interrupted communication between the peripheral device and a host without the need for a user to restart the system or remove and re-insert a cable.
In order to achieve the above object, according to the present invention, a connection unit is provided for a peripheral device that is connected to a host via a data line. The data line is set to a first state at a predetermined potential (such as a high state) when communication between the peripheral device and the host is performed. The connection unit includes a recovering unit that establishes an apparently reconnected state between the peripheral device and the host by changing the potential of the data line to a second state (such as a low state) from the predetermined potential when the communication between the peripheral device and the host is disabled and then by changing the potential of the data line to the predetermined potential (high state).
With such a recovering unit, even if communication between the peripheral device and the host (polling from the host to the peripheral device) is interrupted, it can be apparently reconnected without the need to physically disconnect them, thereby automatically recovering to the normal communication state. This eliminates the need for the operator to remove and reinsert a cable between the peripheral device and the host or to restart the system.
In one embodiment of the connection unit, the data line may be connected to a ground via a first resistor in the host and may be connected to a power supply via a second resistor in the peripheral device. The recovering unit may establish the apparently reconnected state between the peripheral device and the host by setting the data line to the low state in the peripheral device and then by resetting the data line to the high state.
In the above-described embodiment of the connecting unit, the data line may include a Dxe2x88x92 line and a D+ line, and the recovering unit may establish the apparently reconnected state between the peripheral device and the host by setting at least one of the Dxe2x88x92 line and the D+ line to the low state in the peripheral device and then by resetting the data line to the high state.
For example, a switch for controlling the current flow may be provided as the recovering unit on at least one of the Dxe2x88x92 line or the D+ line of the peripheral device. When the peripheral device detects the interruption of the calling from the host or detects a malfunction occurring in the peripheral device, the switch is controlled to apparently disconnect the Dxe2x88x92 line or the D+ line between the peripheral device and the host. This decreases the potential of the Dxe2x88x92 line or the D+ line provided with the second resistor to the ground potential. The host thus determines that the peripheral device is disconnected although it is not physically removed. The peripheral device then resets the switch to the state it was in before the data line was apparently disconnected, thereby increasing the potential of the Dxe2x88x92 line or the D+ line. The host then determines that the peripheral device is reconnected.
In the above-described connecting unit, the recovering unit may establish the apparently reconnected state between the peripheral device and the host by connecting the data line to a ground or causing a portion between the data line and the power supply to have a high impedance to set the portion to the low state and then resetting the portion to the high state.
For example, in setting the data line to the low state, the data line may be directly grounded, or the second resistor between the data line and the power supply may be grounded. Alternatively, the data line may be temporarily opened, or the portion between the second resistor and the power supply may be opened, thereby causing it to become a high impedance. In this case, advantages similar to those exhibited by the above case may be obtained.
In the aforementioned connecting unit, the host may regularly call the peripheral device via the data line, and the recovering unit may establish the apparently reconnected state between the peripheral device and the host when there is no answer from the peripheral device in response to calling by the host a predetermined number of consecutive times.
In the recovering unit, the aforementioned predetermined number of consecutive times of calling is determined by the device specifications, and the recovering unit is operated when the peripheral device determines that the host is not calling.
In the above-described connecting unit, the recovering unit may establish the apparently reconnected state between the peripheral device and the host when detecting that one of a voltage change, a departure of processing from a fixed program routine, and a memory malfunction occurs in the peripheral device. The recovering unit may be operated not only when one of the above-described malfunction occurs in the peripheral device, but also when the calling to the peripheral device is interrupted due to a malfunction occurring in the host.